package com.mike.blog.controller;

import com.mike.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author xiaozefeng
 * @date 2018-12-21 15:03
 */
@Controller
@RequestMapping("/v1/articles")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @GetMapping
    public String index(Model model){
        model.addAttribute("articles", articleService.findAll());
        return "articles";
    }

}
